package com.slimbloody.warmup;

import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class EnableWarmUpAutoConfiguration {
  @Bean
  @ConditionalOnProperty(name = "warm-up.enable", havingValue = "true", matchIfMissing = true)
  public WarmUpComponent warmUpComponent(WarmUpIgnoreConfiguration warmUpIgnoreConfiguration) {
    return new WarmUpComponent(warmUpIgnoreConfiguration);
  }

  @Bean
  @ConditionalOnProperty(name = "warm-up.enable", havingValue = "true", matchIfMissing = true)
  public WarmUpIgnoreConfiguration warmUpIgnoreConfiguration() {
    return new WarmUpIgnoreConfiguration();
  }
}
